<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of VMT_ComputeNormProf</title>
  <meta name="keywords" content="VMT_ComputeNormProf">
  <meta name="description" content="Computes the normaized median profile from multiemsemble data.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
  <script type="text/javascript">
    if (top.frames.length == 0) { top.location = "../index.html"; };
  </script>
</head>
<body>
<a name="_top"></a>
<!-- menu.html VMT_4.0_dev -->
<h1>VMT_ComputeNormProf
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Computes the normaized median profile from multiemsemble data.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [znm,vm] = VMT_ComputeNormProf(zn,v,n) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Computes the normaized median profile from multiemsemble data.

 Inputs:

 zn: matrix of normized, bed origin bin locations (#bins x #ens)
 v:  matrix of observed velocity magniitude (#bins x #ens)
 n:  number of cells to use in the profile binning

 P.R. Jackson, USGS, 8-31-12</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [znm,vm] = VMT_ComputeNormProf(zn,v,n)</a>
0002 <span class="comment">% Computes the normaized median profile from multiemsemble data.</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% Inputs:</span>
0005 <span class="comment">%</span>
0006 <span class="comment">% zn: matrix of normized, bed origin bin locations (#bins x #ens)</span>
0007 <span class="comment">% v:  matrix of observed velocity magniitude (#bins x #ens)</span>
0008 <span class="comment">% n:  number of cells to use in the profile binning</span>
0009 <span class="comment">%</span>
0010 <span class="comment">% P.R. Jackson, USGS, 8-31-12</span>
0011 
0012 <span class="comment">% Reshape the matrices to create vectors</span>
0013 zn_vec = reshape(zn,size(zn,1)*size(zn,2),1);
0014 v_vec  = reshape(v,size(v,1)*size(v,2),1);
0015 
0016 <span class="comment">% Bin the data and compute median values</span>
0017 cell_breaks = 0:1/n:1;  <span class="comment">%Limits of each cell</span>
0018 dum = diff(cell_breaks);
0019 znm = cumsum([(cell_breaks(2)/2) dum(2:end)]);
0020 
0021 vm  = nan*ones(1,n);  <span class="comment">%preallocate</span>
0022 obs = nan*ones(1,n);  <span class="comment">%preallocate</span>
0023 <span class="keyword">for</span> i = 1:n
0024     indx = find(zn_vec &gt;= cell_breaks(i) &amp; zn_vec &lt; cell_breaks(i+1));
0025     vm(i) = nanmedian(v_vec(indx));
0026     obs(i) = length(indx);
0027 <span class="keyword">end</span>
0028 
0029 <span class="comment">% Find any cells that have &lt; 20% of the median number of data points all</span>
0030 <span class="comment">% other bins</span>
0031 indx = find(obs &lt; 0.2*nanmedian(obs));
0032 
0033 <span class="comment">% Plot the data</span>
0034 
0035 <span class="keyword">if</span> 0  <span class="comment">%for debugging</span>
0036     figure(1); clf
0037     plot(v_vec,zn_vec,<span class="string">'k.'</span>); hold on
0038     plot(vm,znm,<span class="string">'bs-'</span>); hold on
0039     plot(vm(indx),znm(indx),<span class="string">'ro'</span>)
0040     xlabel(<span class="string">'velocity'</span>)
0041     ylabel(<span class="string">'normalized height above bottom'</span>)
0042     xlim([0 max(v_vec)])
0043     ylim([0 1])
0044 <span class="keyword">end</span>
0045 
0046 <span class="comment">%Remove lean cells</span>
0047 vm(indx) = nan;
0048 
0049 
0050 
0051     
0052 
0053</pre></div>
<hr><address>Generated on Thu 21-Mar-2013 09:32:01 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
</body>
</html>